home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / midi / gfft.lha / gfft-2.03 / source / gfft-2.03-source.lha / wbhelp.c < prev    next >
C/C++ Source or Header  |  1996-01-02  |  4KB  |  172 lines

  1. /***************************************************************************
  2.  *          Copyright (C) 1994  Charles P. Peterson                  *
  3.  *         4007 Enchanted Sun, San Antonio, Texas 78244-1254             *
  4.  *              Email: Charles_P_Peterson@fcircus.sat.tx.us                *
  5.  *                                                                         *
  6.  *          This is free software with NO WARRANTY.                  *
  7.  *          See gfft.c, or run program itself, for details.              *
  8.  *              Support is available for a fee.                      *
  9.  ***************************************************************************
  10.  *
  11.  * Program:     gfft--General FFT analysis
  12.  * File:        wbhelp.c
  13.  * Purpose:     help requester
  14.  * Author:      Charles Peterson (CPP)
  15.  * History:     2-March-1994 CPP; Created.
  16.  *              7-July-1994 CPP (0.75); Added MORE button
  17.  *              14-Dec-94 CPP (1.17); Fix button gadgets for >4 colors
  18.  * Comments:    Workbench GUI.  Amiga Dependent!
  19.  */
  20.  
  21. #ifdef AMIGA  /* This module is AMIGA dependent */
  22.  
  23. #include <stdio.h>     /* sprintf() */
  24. #include <string.h>
  25.  
  26. /*
  27.  * Amiga includes
  28.  */
  29. #include <exec/types.h>
  30. #include <workbench/workbench.h>
  31. #include <intuition/intuition.h>
  32. #include <clib/intuition_protos.h>
  33. #include <clib/exec_protos.h>
  34. #include <dos.h> /* chkabort() */
  35.  
  36. /*
  37.  * GFFT includes
  38.  */
  39. #include "gfft.h"
  40. #include "settings.h"  /* for testing */
  41. #include "wbench.h"
  42.  
  43. /*
  44.  * External globals
  45.  */
  46. extern struct Window *dialog_window_p;
  47.  
  48. static struct Requester *help_rp = NULL;
  49.  
  50. static struct Gadget *end_help_gadgetp;
  51. static struct Gadget *intro__gadgetp, *enter_topic_gadgetp;
  52. static struct Gadget *topics__gadgetp;
  53. static struct Gadget *more__gadgetp;
  54.  
  55. static struct IntuiText *line1_textp;
  56. static struct IntuiText *line2_textp;
  57. static struct IntuiText *line3_textp;
  58. static struct IntuiText *line4_textp;
  59. static struct IntuiText *line5_textp;
  60.  
  61.  
  62. void workbench_help_requester (void)
  63. {
  64.     struct IntuiMessage *message;
  65.     APTR *address = NULL;
  66.     ULONG class = 0;
  67.     UWORD qualifier = NULL;
  68.  
  69.     if (!help_rp)
  70.     {
  71.     gadget__begin (GTYP_REQGADGET);
  72. /*
  73.  * Setup Text
  74.  */
  75.     line1_textp = requester_text__new
  76.   ("For help with any gadget, hold the CTRL key while clicking it.",
  77.    0, 0);
  78.  
  79.     line2_textp = requester_text__new
  80.   ("For information about the author, available services, and your rights",
  81.    0, 1);
  82.  
  83.     line3_textp = requester_text__new
  84.   ("    regarding this program, click the version/copyright button (top).",
  85.    0, 2);
  86.  
  87.     line4_textp = requester_text__new
  88.   ("HINT: After selecting Sample File (and modifying parameters and options,",
  89.    0, 3);
  90.  
  91.     line5_textp = requester_text__new
  92.   ("    if desired) click the OK button (bottom right of dialog window).",
  93.    0, 4);
  94.  
  95. /*
  96.  * Setup Gadgets
  97.  */
  98.     more__gadgetp = action_button__new ("MORE",
  99.                         64, 0);
  100.  
  101.     intro__gadgetp = action_button__new ("Intro",
  102.                         0, 5);
  103.  
  104.     topics__gadgetp = action_button__new ("Topics", 8, 5);
  105.  
  106. #define MAX_TOPIC_LENGTH 50
  107.     enter_topic_gadgetp = string_gadget__new ("Topic:", 
  108.                           NullString,
  109.                           MAX_TOPIC_LENGTH,
  110.                           43, 17, 5);
  111.  
  112.     end_help_gadgetp = tall_action_button__new
  113.       ("...OK",
  114.        63, 5);
  115.  
  116.     help_rp = requester__new ();
  117.     help_rp->ReqGadget = end_help_gadgetp;
  118.     help_rp->ReqText = line5_textp;
  119.  
  120.     } /* Ok, help_rp has been created */
  121.     
  122.     if (requester__display (help_rp, dialog_window_p))
  123.     {
  124.     while (TRUE)
  125.     {
  126.         Wait (1 << dialog_window_p->UserPort->mp_SigBit);
  127.         while (message = (struct IntuiMessage *) GetMsg 
  128.            (dialog_window_p->UserPort))
  129.         {
  130.         CATCH_ERROR
  131.         class = message->Class;
  132.         qualifier = message->Qualifier;
  133.         address = message->IAddress;
  134.         ReplyMsg ((struct Message *) message);
  135.         if (address == (APTR) intro__gadgetp)
  136.         {
  137.             help_message ("introduction");
  138.         }
  139.         else if (address == (APTR) more__gadgetp)
  140.         {
  141.             help_message ("Workbench More-Help");
  142.         }
  143.         else if (address == (APTR) topics__gadgetp)
  144.         {
  145.             help_message ("topics");
  146.         }
  147.         else if (address == (APTR) enter_topic_gadgetp)
  148.         {
  149.             if (qualifier & IEQUALIFIER_CONTROL)
  150.             {
  151.             help_message ("Workbench Help Topics");
  152.             }
  153.             else
  154.             {
  155.             if (class == IDCMP_GADGETDOWN) break;
  156.             string_gadget__apply 
  157.               (enter_topic_gadgetp, help_message);
  158.             }
  159.         }
  160.         else if (address == (APTR) end_help_gadgetp)
  161.         {
  162.             requester__remove (help_rp, dialog_window_p);
  163.             return;
  164.         }
  165.         END_CATCH_ERROR
  166.         }
  167.     }
  168.     }
  169. }
  170.  
  171. #endif /* end ifdef AMIGA */
  172.